﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using AutoMapper;
using Smalt.DomainModels.Interfaces;

namespace Smalt.MVC.Mappings.Resolvers
{
    public class TeamViewResolver : ValueResolver<ITeamHolder, Dictionary<int, string>>
    {
        protected override Dictionary<int, string> ResolveCore(ITeamHolder source)
        {
            Dictionary<int, string> teams = new Dictionary<int, string>();

            foreach (var team in source.Teams)
            {
                teams.Add(team.Id, team.Name);
            }

            return teams;
        }
    }
}